import { defineConfig } from "umi";
import routes from "./routes";
import PostcssPxToRem from "postcss-pxtorem";
export default defineConfig({
  npmClient: "pnpm",
  alias: {
    "@p": "/src/pages",
    "@a": "/src/assets",
  },

  routes,
  proxy: {
    "/conner": {
      target: "https://api.it120.cc",
      changeOrigin: true,
      pathRewrite: { "^/conner": "/conner" },
    },
  },

  define: {
    "process.env": {
      NODE_ENV: "development",
      UMI_ENV: "dev",
      UMI_BASE_URL: "/conner",
    },
  },

  extraPostCSSPlugins: [
    PostcssPxToRem({
      // 定义1rem 单位 一般设置为设计图的 10分之一
      rootValue: 40,
      // 定义哪些css属性会自动将px转换成rem PX 不转换
      propList: ["width", "height", "margin", "line-height", "letter-spacing"],
      exclude: /node_modules/i,
    }),
  ],

  dva: {},
  plugins: ["@umijs/plugins/dist/dva"],
});
